package cn.zqy.demo2.day05.Exception;

//如果finally有return语句,永远返回finally中的结果,避免该情况.

public class Demo09FinallyReturn {
    public static void main(String[] args) {
        int i = returnFinally();
        System.out.println(i);  // 199  永远返回finally中的值
    }

    private static int returnFinally() {
        int a = 10;
        try {
            return a;
        } catch (Exception e) {
            System.out.println(e);
        } finally {
            a = 199;
            return a;
        }
    }
}
